#!/bin/sh
# 
# Add a new text file in the current directory.
# If "New Document[ number].txt" already exists,
# then the [ number] is incremented until unique.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Copyright (C) 2001 Jeffrey Phillips <jeffrey.phillips@staffeon.com>


COUNT=1

if ! [ -a "./New Document.txt" ] ; then
  touch "./New Document.txt"
else
  while ! [ "$retry" ] ; do
    let $((COUNT++))
    if ! [ -a "./New Document ($COUNT).txt" ] ; then
        touch "./New Document ($COUNT).txt"
	retry=1
    fi
  done
fi
